public class BoardState {

	private boolean[][] board;
	
	public BoardState(boolean[][] b) {
		this.board = new boolean[b.length][b.length];
		for(int i = 0; i < b.length; i++) {
			for(int j = 0; j < b[i].length; j++) {
				this.board[i][j] = b[i][j];
			}
		}
	}
//	
	public static void imprimeTabuleiro(int n,boolean matriz[][]){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(matriz[i][j]==true){
					System.out.print("R ");
				}else{
					System.out.print("X ");
				}
			}
			System.out.println("");
		}
		System.out.println("");
	}
//
	public BoardState(int n) {
		this.board = new boolean[n][n];
		for(int i = 0; i < this.board.length; i++) {
			for(int j = 0; j < this.board[i].length; j++) {
				this.board[i][j] = false;
			}
		}
		imprimeTabuleiro(this.board.length,board);
	}
	
	public void changeRow(boolean[] row, int rowNum) {
		boolean[] tempRow = new boolean[row.length];
		for(int i = 0; i < row.length; i++) {
			tempRow[i] = row[i];
		}
		this.board[rowNum] = tempRow;
	}
	
	public void modifyBoard(int x, int y, boolean b) {
		this.board[x][y] = b;
		imprimeTabuleiro(this.board.length,board);
	}
	
	public boolean isOccupied(int x, int y) {
		return this.board[x][y];
	}
	
	public int getBoardSize() {
		return this.board.length;
	}
	
	public boolean[][] getBoard() {
		return this.board;
	}
	
	public String toString() {
		String ret = "[";
		for(int i = 0; i < this.board.length; i++) {
			for(int j = 0; j < this.board[i].length; j++) {
				if(j == 0)
					ret += this.board[i][j];
				else
					ret += ", " + this.board[i][j];
			}
			if(i != (this.board.length - 1))
				ret += "]\n[";
			else
				ret += "]";
		}
		return ret;
	}

}